<?php
require("dbinfo.php");

$lat = $_GET['lat'];
$lng = $_GET['lng'];
$tipo = $_GET['tipo'];

//Abre a conexao com o banco MySql
$connection = mysql_connect(localhost, $username, $password);
if(!$connection){
	die('Nao conectado: ' . mysql_error());	
}

//Seleciona o banco de dados MySql
$db_selected = mysql_select_db($database, $connection);
if(!$db_selected){
	die('Nao eh possivel usar o DB: ' . mysql_error());	
}

//Seleciona todas as linhas na tabela de objetos
$query = "INSERT INTO objeto (latitude, longitude, tipo) VALUES ('" . $lat . "', '" . $lng . "', " . $tipo . ")";
$result = mysql_query($query);
if(!$result){
	die('Query Invalida: ' . mysql_error());	
}

mysql_close($connection);
?>